package com.ruoyi.system.utils;

/**
 * 水电表指令常量类
 */
public class InstructConstant {
    //指令发送redis标识
    public static String handleInstructs = "iot:instructs:";
    //获取电表参数保存到redis中的标识
    public static String SUMMARY_INSTRUCTS = "iot:summary:";
    //485-1心跳包信息
    public static String RS485_1_HEARTBEAT = "1174880431";
    //485-2心跳包信息
    public static String RS485_2_HEARTBEAT = "2174880431";
    //唤醒码
    public static String FE_1 = "FE ";

    public static String FE_2 = "FE FE ";

    public static String FE_3 = "FE FE FE ";

    public static String FE_4 = "FE FE FE FE ";

    public static String START_CHARACTER_68 = "68";

    /**
     * 电表指令描述
     * 1. FE位唤醒码一般有0-4个  【FE FE】 68 AA AA AA AA AA AA 68 01 02 65 F3 27 16
     * 2. 68 是帧起始符 FE FE 【68】 AA AA AA AA AA AA 【68】 01 02 65 F3 27 16
     * 3. 两个68之间的是设备的地址，一般是指设备编号 FE FE 68 【AA AA AA AA AA AA】 68 01 02 65 F3 27 16
     * 4. 01是操作码 01-表示读，04-表示写 FE FE 68 AA AA AA AA AA AA 68 【01】 02 65 F3 27 16
     * 5. 表示数据字节长度 FE FE 68 AA AA AA AA AA AA 68 01 【02】 65 F3 27 16
     * 6. 【65 F3】表示数据 FE FE 68 AA AA AA AA AA AA 68 01 02 【65 F3】 27 16
     * 7. 27是校验码，是27前面全部数据字节和取模256的结果（不包含FE） FE FE 68 AA AA AA AA AA AA 68 01 02 65 F3 27 16
     * 8. 16是结束符固定值
     */
    /**获取电表号指令*/
    public static String ELECTRICITY_METER_INSTRUCT = "FE FE 68 AA AA AA AA AA AA 68 01 02 65 F3 27 16";
    /**查电表用量指令 {0}-设备号*/
    public static String ELECTRICITY_METER_USED_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 01 02 43 C3";
    /**拉总闸 {0}-设备号 */
    public static String ELECTRICITY_METER_PULL_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 67 45";
    /**合总闸 {0}-设备号*/
    public static String ELECTRICITY_METER_ON_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 AB 89";
    /**A拉闸 {0}-设备号*/
    public static String ELECTRICITY_METER_A_PULL_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 88 66";
    /**A合闸 {0}-设备号*/
    public static String ELECTRICITY_METER_A_NO_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 99 CC";
    /**B拉闸 {0}-设备号*/
    public static String ELECTRICITY_METER_B_PULL_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 55 44";
    /**B合闸 {0}-设备号*/
    public static String ELECTRICITY_METER_B_NO_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 08 5B F3 33 33 33 33 BB AA";
    /**电表的 总电压（AB路）、功率、电流、频率，A路*/
    public static String ELECTRICITY_METER_SUMMARY_INFO_INSTRUCT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 01 02 B3 E9";
    /**电表 A路功率设置*/
    public static String ELECTRICITY_A_POWER_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 09 85 FF 33 33 33 33 {1}";
    /**电表 B路功率设置*/
    public static String ELECTRICITY_B_POWER_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 09 85 FF 33 33 33 33 {1}";
    /**电表 A路周休特征字*/
    public static String ELECTRICITY_WEEY_A_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 08 55 F3 33 33 33 33 B2 33";
    /**电表 B路周休特征字*/
    public static String ELECTRICITY_WEEY_B_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 08 55 F3 33 33 33 33 B2 B2";
    /**电表 A路工作日 时段控制设置*/
    public static String ELECTRICITY_A_TIME_WORK_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 24 72 F6 33 33 33 33 {1} 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33";
    /**电表 A路休息日 时段控制设置*/
    public static String ELECTRICITY_A_TIME_REST_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 24 82 F6 33 33 33 33 {1} 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33";
    /**电表 B路工作日 时段控制设置*/
    public static String ELECTRICITY_B_TIME_WORK_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 24 92 F6 33 33 33 33 {1} 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33";
    /**电表 B路休息日 时段控制设置*/
    public static String ELECTRICITY_B_TIME_REST_SETUP = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 +" 04 24 A2 F6 33 33 33 33 {1} 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33 44 33 33";
    /**查询电表余额*/
    public static String ELECTRICITY_BALANCE = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 01 02 4A 1C";
    /**电费充值 {1} 购电次数  {2} 购电金额 {3} 购电类型 33-开户  34-充值 */
    public static String ELECTRICITY_RECHARGE = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 0F 48 1C 33 33 33 33 {1} 32 32 {2} 34";
    /**电费开户 {1} 购电次数  {2} 购电金额 {3} 购电类型 33-开户  34-充值*/
    public static String ELECTRICITY_OPEN_ACCOUNT = FE_2 + START_CHARACTER_68 +" {0} "+ START_CHARACTER_68 + " 04 0F 48 1C 33 33 33 33 {1} 32 32 {2} 33";

    /**查询水表信息指令*/
    public static String WATER_METER_READ_DATA = FE_2 + START_CHARACTER_68 +" 10 {0} " + "01 03 90 1F 00";
    /**开阀水表信息指令*/
    public static String WATER_METER_NO = FE_2 + START_CHARACTER_68 +" 10 {0} " + "2A 04 A0 17 00 55";
    /**关阀水表信息指令*/
    public static String WATER_METER_OFF = FE_2 + START_CHARACTER_68 +" 10 {0} " + "2A 04 A0 17 00 99";

}
